package top.tsyz.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.tsyz.entity.AdminRol;
import top.tsyz.service.IAdminRolService;

import java.util.List;

/**
 * AdminRolController控制器
 */
@RestController
@RequestMapping("/api/adminRoles")
@Api(tags = "AdminRol管理接口")
public class AdminRolController {

    @Autowired
    private IAdminRolService iadminrolservice;

    @GetMapping("/list")
    @ApiOperation("获取所有AdminRol")
    public List<AdminRol> list() {
        return iadminrolservice.list();
    }

    @GetMapping("/{id}")
    @ApiOperation("根据ID获取AdminRol")
    public AdminRol getById(@PathVariable Long id) {
        return iadminrolservice.getById(id);
    }

    @PostMapping
    @ApiOperation("新增AdminRol")
    public boolean save(@RequestBody AdminRol adminrol) {
        return iadminrolservice.save(adminrol);
    }

    @PutMapping
    @ApiOperation("更新AdminRol")
    public boolean update(@RequestBody AdminRol adminrol) {
        return iadminrolservice.updateById(adminrol);
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除AdminRol")
    public boolean delete(@PathVariable Long id) {
        return iadminrolservice.removeById(id);
    }
}
